package com.mc.moring.util

import android.graphics.Color

object LoanState {

    private val RED = Color.parseColor("#FF6265")
    private val YELLOW = Color.parseColor("#E9971C")
    private val GREEN = Color.parseColor("#01DDC3")
    private val GRAY = Color.parseColor("#8E8E8E")

    const val TYPE_01 = -1
    const val TYPE_02 = -2
    const val TYPE_0 = 0
    const val TYPE_1 = 1
    const val TYPE_1001 = 1001
    const val TYPE_1002 = 1002
    const val TYPE_1004 = 1004
    const val TYPE_2001 = 2001
    const val TYPE_2002 = 2002
    const val TYPE_2003 = 2003
    const val TYPE_2004 = 2004
    const val TYPE_3001 = 3001
    const val TYPE_3002 = 3002
    const val TYPE_3003 = 3003
    const val TYPE_4001 = 4001

    fun getText(type: Int?): String {
        return when (type) {
            TYPE_01 -> "Rechazado"
            TYPE_02 -> "Desembolso fallido repetidamente"
            TYPE_0 -> "Contrato firmando"
            TYPE_1 -> "Firma fallída"
            TYPE_1001 -> "Revisando"
            TYPE_1002 -> "Préstamo aprobado"
            TYPE_1004 -> "Revisión fallida"
            TYPE_2001 -> "Desembolso procesando"
            TYPE_2002 -> "Desembolso exitoso"
            TYPE_2003 -> "Desembolso fallido"
            TYPE_3001 -> "Reembolso procesando"
            TYPE_3002 -> "Atrasado"
            TYPE_3003 -> ""
            TYPE_4001 -> "Liquidado"
            TYPE_2004 -> "Desembolso procesando"
            else -> ""
        }
    }

    fun getColor(type: Int): Int {
        return when (type) {
            TYPE_01 -> RED
            TYPE_02 -> RED
            TYPE_0 -> GRAY
            TYPE_1 -> GRAY
            TYPE_1001 -> GRAY
            TYPE_1002 -> YELLOW
            TYPE_1004 -> GRAY
            TYPE_2001 -> YELLOW
            TYPE_2002 -> GREEN
            TYPE_2003 -> YELLOW
            TYPE_3001 -> YELLOW
            TYPE_3002 -> RED
            TYPE_3003 -> RED
            TYPE_4001 -> GREEN
            TYPE_2004 -> YELLOW
            else -> Color.TRANSPARENT
        }
    }

}